﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using MyMES.Dto;
using MyMES.IServices;
using VOL.Core.Utilities;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels;
using VOL.Entity.DomainModels.Core;

namespace VOL.WebApi.Controllers.WarehouseManagement
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PurchaseWarehousingController : ControllerBase
    {
        private readonly IPurchaseWarehousingService _purchaseWarehousingService;
        private readonly ILogger<PurchaseWarehousingController> _logger;

        public PurchaseWarehousingController(IPurchaseWarehousingService purchaseWarehousingService, ILogger<PurchaseWarehousingController> logger)
        {
            _purchaseWarehousingService = purchaseWarehousingService;
            _logger = logger;
        }
        
        [HttpPost]
        public Task<PageGridData<PurchaseWarehousingDTO>> GetPurchaseWarehousing([FromBody]GetPurchaseDTO dto)
        {
            return _purchaseWarehousingService.GetPurchaseWarehousing(dto);
        }
        [HttpPost]
        public async Task<WebResponseContent> AddPurchaseWarehousing([FromBody] PurchaseWarehousing purchase)
        {
            return await _purchaseWarehousingService.AddPurchaseWarehousing(purchase);
        }

        [HttpPost]
        public async Task<WebResponseContent> UpdPurchaseWarehousing([FromBody]PurchaseWarehousing purchase)
        {
            return await _purchaseWarehousingService.UpdPurchaseWarehousing(purchase);
        }

        [HttpPost]
        public async Task<WebResponseContent> RemPurchaseWarehousing(string inboundListCode)
        {
            return await _purchaseWarehousingService.RemPurchaseWarehousing(inboundListCode);
        }

        [HttpGet]
        public async Task<WebResponseContent> FindPurchaseWarehousing(string inboundListCode)
        {
            return await _purchaseWarehousingService.FindPurchaseWarehousing(inboundListCode);
        }
    }
}
